local Client = require "agents.client"

local login_manager = {}

local clients = {}

function login_manager.getClient(fd)
    return clients[fd] or nil
end

function login_manager.addClient(fd)
    local client = Client:new(fd)
    clients[fd] = client
    return client
end

function login_manager.removeClient(fd)
    clients[fd] = nil
end

function login_manager.foreach(func)
    for k,v in pairs(clients) do
        func(k,v)
    end
end

function login_manager.clearAll()
    clients = {}
end

return login_manager